/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package br.com.sales.hancadpe.client.service;

import br.com.sales.generics.client.HanRequestBuilder;
import br.com.sales.generics.client.request.HannaRequestCallback;
import com.google.gwt.json.client.JSONArray;
import com.google.inject.Inject;
import java.util.Map;

/**
 *
 * @author v
 */
public class HanCadPEService {

    @Inject
    private HanRequestBuilder requestProxy;

    public void insertPerson(Map fields, HannaRequestCallback callback) {
        JSONArray array = new JSONArray();
        array.set(0, requestProxy.formatJson(fields));

        requestProxy.sendRequest("HanCadPE", "insertPerson", array, callback);
    }

    public void getDateGrid(Integer page, HannaRequestCallback callback) {
        JSONArray array = new JSONArray();
        array.set(0, requestProxy.formatJson(page));

        requestProxy.sendRequest("HanCadPE", "getDateGrid", array, callback);
    }

    public void inactivate(Long sequence, HannaRequestCallback callback) {
        JSONArray array = new JSONArray();
        array.set(0, requestProxy.formatJson(sequence));

        requestProxy.sendRequest("HanCadPE", "inactivate", array, callback);
    }

    public void validateDocument(Map itens, HannaRequestCallback callback) {
        JSONArray array = new JSONArray();
        array.set(0, requestProxy.formatJson(itens));

        requestProxy.sendRequest("HanCadPE", "validateDocument", array, callback);
    }
    
    public void refreshPerson(Map itens, HannaRequestCallback callback) {
        JSONArray array = new JSONArray();
        array.set(0, requestProxy.formatJson(itens));

        requestProxy.sendRequest("HanCadPE", "refreshPerson", array, callback);        
    }
}
